1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

replace tcc process space?

Discussion in 'Support' started by Stefano Piccardi, Oct 11, 2011.

  1. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    From a batch file I want to run a new tcc.exe (started) so that it completely replaces the process space of the current tcc.exe (starter). Is it possible?
    This is analogous to running a batch script without CALL from within a batch script; the former replaces the latter.
    What I'm after is something like the exec comand of the *nix bash shell http://ss64.com/bash/exec.html (just the bit about not creating a new process).
    Code:
    invoking process <=> starter tcc -> started tcc
    invoking process <=> started tcc
    So, started tcc inherits starter's PID, environment and console window, and returns exit status to the invoking process.
    Also note that starter and started tccs can be different versions.
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,785
    Likes Received:
    29
    On Tue, 11 Oct 2011 19:19:41 -0400, Stefano Piccardi <>
    wrote:

    |From a batch file I want to run a new tcc.exe (startee) so that it completely replaces the process space of the current tcc.exe (starter). Is it possible?
    |This is analogous to running a batch script without CALL from within a batch script; the former replaces the latter.
    |Mind that the START command isn't an acceptable solution, since I don't want to create a new console window.

    Just use START with "/B" (don't create a new console) and in the batch file,
    EXIT (the current instance of TCC). The batch file will terminate, of course.

    Simply:

    Code:
    START /B
    EXIT
     
  3. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,785
    Likes Received:
    29
    On Wed, 12 Oct 2011 02:02:03 -0400, Stefano Piccardi <>
    wrote:

    |---Quote (Originally by vefatica)---
    |Simply:
    |
    |Code:
    |---------
    |START /B
    |EXIT
    |---------
    |---End Quote---
    |Thanks. But I added more requirements which make START /B not suitable.
    |Find updated requirements in my OP 3280-replace-tcc-process-space-post18228.html (http://jpsoft.com/forums/support/3280-replace-tcc-process-space-post18228.html#poststop)

    Read about C's _exec() and _wexec() here:
    http://msdn.microsoft.com/en-us/library/aa246812%28v=vs.60%29.aspx

    I don't think TCC uses it and I doubt very much that the PID would be preserved
    on Windows
     
  5. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,730
    Likes Received:
    80
    That is impossible to do in Windows. (A process cannot "inherit" a PID.)
     
  6. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,178
    Likes Received:
    11
    Why do you want or need this functionality?
    -Scott



    From a batch file I want to run a new tcc.exe
    (startee) so that it completely replaces the process space of the current
    tcc.exe (starter). Is it possible?
    This is analogous to running a batch script without CALL from within a
    batch script; the former replaces the latter.
    Mind that the START command isn't an acceptable solution, since I don't
    want to create a new console window.
     
  7. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    Because I want to seamlessly turn TCCLE into TCC with just one running process. By "seamlessly turn into" I mean that TCC inherits TCCLE's process space (open file descriptors, console window, environment block), just like the _exec() family of system functions describes.
    Rex suggested that PID can't be kept, so I'll give up on that.

    I want to turn TCCLE into TCC as a work-around to the current limitation of portable TCC/TCMD, which is that they don't allow for a USB disk drive as a portable installation target. This is a problem in my own system setup which is rather complex.

    The gist of my work-around is to install a portable TCMD on a USB key, then link the disk drive TCMD folder to the USB key TCMD folder.

    As I found out, linking the folders isn't enough. To complete my work-around I need to redirect starting tcc.exe/tcmd.exe through TCCLE, which has no portability limitations.

    This redirection is transparently achieved once again by linking the disk drive TCMD folder to the TCCLE folder, then having TCCLE\TCSTART.btm figure out when/how to start USB key tcc.exe/tcmd.exe.
    That's where being able to turn TCCLE into tcc.exe becomes useful.

    Using TCCLE as the redirector to tcc/tcmd is ideal: they share the same command-line interface and TCCLE batch commands are very powerful, so the redirection can be fine tuned easily.

    I still wish Rex was able to relax the current limitation on portability, but I understand there are both technical hurdles and business considerations that make those changes very unlikely to happen.
     
  8. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,178
    Likes Received:
    11
    Wouldn't it be easier to just keep track
    of the key files? Can't you switch the keys files in and out when
    you move your drive from one machine to the other?

    -Scott



    Because I want to seamlessly turn TCCLE
    into TCC with just one running process. By "seamlessly turn into"
    I mean that TCC inherits TCCLE's process space (open file descriptors,
    console window, environment block), just like the _exec() family of system
    functions describes.
    Rex suggested that PID can't be kept, so I'll give up on that.

    I want to turn TCCLE into TCC as a work-around to the current limitation
    of portable TCC/TCMD, which is that they don't allow for a USB disk
    drive as a portable installation target. This is a problem in my own
    system setup which is rather complex.

    The gist of my work-around is to install a portable TCMD on a USB key,
    then link the disk drive TCMD folder to the USB key TCMD folder.

    As I found out, linking the folders isn't enough. To complete my work-around
    I need to redirect starting tcc.exe/tcmd.exe through TCCLE, which has no
    portability limitations.

    This redirection is transparently achieved once again by linking the disk
    drive TCMD folder to the TCCLE folder, then having TCCLE\TCSTART.btm figure
    out when/how to start USB key tcc.exe/tcmd.exe.
    That's where being able to turn TCCLE into tcc.exe becomes useful.

    Using TCCLE as the redirector to tcc/tcmd is ideal: they share the same
    command-line interface and TCCLE batch commands are very powerful, so the
    redirection can be fine tuned easily.

    I still wish Rex was able to relax the current limitation on portability,
    but I understand there are both technical hurdles and business considerations
    that make those changes very unlikely to happen.
     
  9. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    Not possible. TCMD only looks at key files on removable drives, and a USB disk isn't considered a removable drive. Only a USB stick is.
     

Share This Page