File tree 2 files changed +9
-8
lines changed
plugins/plugin-codeflare/src/controller
2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ export async function attach(
112
112
*
113
113
* @return the local logdir for the run
114
114
*/
115
- export default async function attachCommand ( args : Arguments < Options > ) {
115
+ export default async function attachCommand ( args : Arguments < Options > , wait = args . parsedOptions . wait ) {
116
116
const jobId = args . parsedOptions . a
117
117
const store = args . parsedOptions . s || process . env . GUIDEBOOK_STORE
118
118
const profile = args . parsedOptions . p || ( await import ( "madwizard" ) . then ( ( _ ) => _ . Profiles . lastUsed ( ) ) )
@@ -126,13 +126,14 @@ export default async function attachCommand(args: Arguments<Options>) {
126
126
process . once ( "exit" , ( ) => {
127
127
console . error ( "attach exit" )
128
128
} )
129
- if ( args . parsedOptions . wait ) {
129
+ if ( wait ) {
130
130
await new Promise < void > ( ( resolve ) => {
131
- process . once ( "SIGTERM" , ( ) => {
132
- console . error ( "attach sigterm" )
133
- cleanExit ( "SIGTERM" )
134
- resolve ( )
135
- } )
131
+ [ "SIGINT" as const , "SIGTERM" as const ] . forEach ( ( signal ) =>
132
+ process . once ( signal , ( ) => {
133
+ cleanExit ( signal )
134
+ resolve ( )
135
+ } )
136
+ )
136
137
} )
137
138
}
138
139
} else {
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export const followFlags: CommandOptions["flags"] = {
44
44
async function dashboardcli ( args : Arguments < DashboardOptions > ) {
45
45
if ( args . parsedOptions . attach ) {
46
46
// attach to a running job
47
- const logdir = await import ( "./attach" ) . then ( ( _ ) => _ . default ( args ) )
47
+ const logdir = await import ( "./attach" ) . then ( ( _ ) => _ . default ( args , true ) )
48
48
return args . REPL . qexec ( `codeflare dashboardui -f ${ encodeComponent ( logdir ) } ` )
49
49
}
50
50
You can’t perform that action at this time.
0 commit comments