long ExecCmd( const char *file_in, const char *file_out, const char *cmd ) { int len; unsigned long stat; char *err; char buff[256]; int linked; err = BatchLink( NULL ); if( err != NULL ) { printf( "link error: %s\n", err ); exit( 1 ); } BatchSpawn( cmd ); for( ;; ) { len = BatchCollect( buff, sizeof( buff ), &stat ); if( len == -1 ) { printf( "done: status = %d\n", stat ); break; } else if( kbhit() ) { if( getch() == 'a' ) { BatchAbort(); } else { BatchCancel(); } } else if( len != 0 ) { buff[len] = '\0'; printf( "%s", buff ); fflush( stdout ); } } return( 1 ); }
void VMsgLog::stopRequest( WMenuItem* ) { if( _running ) { MsgRetType ret = WMessageDialog::messagef( this, MsgInfo, MsgOkCancel, NULL, "OK to interrupt the executing process?" ); if( ret == MsgRetOk ) { if( !_batserv ) { #ifdef __WINDOWS__ VxDRaiseInterrupt( 0x1B ); //send ctrlBreak addLine( "Stop invoked..." ); #endif } else { if( BatchCancel() ) { addLine( "Stop failed" ); } else { addLine( "Stop invoked..." ); } } } } }