File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
plugins/plugin-codeflare/src/controller Expand file tree Collapse file tree 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(
112112 *
113113 * @return the local logdir for the run
114114 */
115- export default async function attachCommand ( args : Arguments < Options > ) {
115+ export default async function attachCommand ( args : Arguments < Options > , wait = args . parsedOptions . wait ) {
116116 const jobId = args . parsedOptions . a
117117 const store = args . parsedOptions . s || process . env . GUIDEBOOK_STORE
118118 const profile = args . parsedOptions . p || ( await import ( "madwizard" ) . then ( ( _ ) => _ . Profiles . lastUsed ( ) ) )
@@ -126,13 +126,14 @@ export default async function attachCommand(args: Arguments<Options>) {
126126 process . once ( "exit" , ( ) => {
127127 console . error ( "attach exit" )
128128 } )
129- if ( args . parsedOptions . wait ) {
129+ if ( wait ) {
130130 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+ )
136137 } )
137138 }
138139 } else {
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export const followFlags: CommandOptions["flags"] = {
4444async function dashboardcli ( args : Arguments < DashboardOptions > ) {
4545 if ( args . parsedOptions . attach ) {
4646 // attach to a running job
47- const logdir = await import ( "./attach" ) . then ( ( _ ) => _ . default ( args ) )
47+ const logdir = await import ( "./attach" ) . then ( ( _ ) => _ . default ( args , true ) )
4848 return args . REPL . qexec ( `codeflare dashboardui -f ${ encodeComponent ( logdir ) } ` )
4949 }
5050
You can’t perform that action at this time.
0 commit comments