Author Topic: concurrent process finished event?  (Read 4765 times)

rayd

  • New Community Member
  • Posts: 1
  • Hero Points: 0
concurrent process finished event?
« on: January 08, 2007, 04:34:12 pm »
I'm trying to run some operations depending on the exit status of a process created via concur_command() on xp, but at the moment I can't find any sort of callback/event that I can hook into to retrieve the status value once the command finishes.  I can get the status value by using shell() instead, but then I'm unable to trap the output into the proper buffer.  Has anyone done something similar to this that could offer me some tips?

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 285
Re: concurrent process finished event?
« Reply #1 on: January 08, 2007, 05:29:33 pm »
I think this is only supported by the 'Build' system (vsbuild).
It's the only way I know, which runs conc. cmds, syncs to the end of them and provides a callback mechanism.
You could setup a special project using the std. Compile,Build or Rebuild commands.

Sync to the command completion by providing this callback:
Code: [Select]
// Slick callback invoked after completion of a (project specific) Compile,Build or Rebuild command
// @see compile.e - execute_post_build() etc.
void _postbuild_rayd (...)
{
   // say ("proj_name:" arg( 1 ) );
   // maybe use arg( 1 ) == project name to trigger some specific things

   // meaningless sample code...
   bottom_of_build ( );
   cursor_data();
   _beep ();
}

Unfortunately you need sth. special to retrieve the exit status (e.g. a result file containing the exit status).

Good luck,

HS2

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4405
  • Hero Points: 331
Re: concurrent process finished event?
« Reply #2 on: January 08, 2007, 09:24:15 pm »
I think this can be done with a batch program.  Wrapper the command that you are executing with a batch program (windows .cmd) which checks the return code of the program.  If you don't already know how to do this in a batch program you'll have to look it up since I don't know off the top of my head.

Now for the trick!  Use the "echo" command in the batch macro and prefix the Slick-C macro you want to run with character code 1 (not the number 1).    You can test this from the SlickEdit command line by typing "concur-command echo popup-message sdfsdf.

I hope this email works with a binary 1 character in it.  There is supposed to be a binary 1 character before the "popup-message" command.

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 285
Re: concurrent process finished event?
« Reply #3 on: January 28, 2007, 02:48:13 pm »
Thanks for this hint Clark !

After fiddeling around a bit I finally got it.
'The Trick' allows to embed Slick macros in shell scripts, if they are invoked in SE (e.g. build win) - it's just great ;)

Sample cmd-batch for all others who are interested in a simple example:
Code: [Select]
set ddir=Z:\windows

dir %ddir%
@if %ERRORLEVEL% EQU 0 goto ok

@REM embed Slick macro here
echo <binary 1>popup-message %ddir% not found: ERRORLEVEL=%ERRORLEVEL%
goto end

:ok
@REM and here
echo <binary 1>popup-message dir %ddir% executed: ERRORLEVEL=%ERRORLEVEL%

:end

HS2