User forums > Using Code::Blocks

post-build commands

(1/2) > >>

Eric Burnett:
How would I go about using the post-build commands? I have tried for a while and can't get anything at all to happen. The closest I can figure is that the compiler-independant option, console shell, is not configurable, and is stuck using a linux file (xterm). Could this be what the problem is?

Specifically, in the post-build commands box, I have:

--- Code: ---start "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:update /path:"C:\Documents and Settings\Eric Burnett\Desktop\fractalBrowser" /notempfile
start "C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:commit /path:"C:\Documents and Settings\Eric Burnett\Desktop\fractalBrowser" /notempfile
--- End code ---


Ideally, I would have it commit my code to a repository on a successful build, but I am having trouble atm.

Thanks!

--Eric Burnett

mandrav:

--- Quote ---The closest I can figure is that the compiler-independant option, console shell, is not configurable, and is stuck using a linux file (xterm)
--- End quote ---

This is disabled because it only makes sense under linux. For windows the command shell is standard (cmd.exe or command.exe). In linux there are too many shells and terminals to choose from ;)

Note that the commands you can use must be existing executables. This means you can use cp.exe, but you can't use copy because copy is an internal shell command (search for copy.exe - you 'll find nil).
I 'm not sure, but I think start is also an internal command.
To overcome this limitation, you can enter your commands in a batch file and use this in the commands box.


--- Quote ---Ideally, I would have it commit my code to a repository on a successful build, but I am having trouble atm.
--- End quote ---

Keep in mind that if this action asks you for a password, you will not see it because codeblocks doesn't run the commands in an interactive shell...
In this case, a solution would be (I haven't tried it!):
Suppose you have your commands in a batch file named commit_after_build.bat.
You would normally use as a post-build command in codeblocks: commit_after_build.bat
To run this in an interactive shell, use this: cmd /k commit_after_build.bat.
This will run your commands in an interactive shell ("dos" box) and keep it open until the commands finish executing.

HTH,
Yiannis.

Eric Burnett:
Ok, I see what I was doing wrong. But I still can't get it to do anything at all...when I type anything (including 'cmd /k commit_after_build.bat', which now refers to a batch file in the root directory of my project), nothing happens. And also, nothing is logged on any of the bottom tabs like I would have expected, which leads me to believe that this is actually disabled/broken at the time being. I would have expected 'cmd /k' to at least bring up a commnd prompt.

mandrav:
The post-build step is ran just after linking. If you 're trying it on an already linked project, the post-build step won't run...
To test it, delete the executable to force it to be re-linked.

Yiannis.

mandrav:
I just noticed there is a bug with the pre-build and post-build commands, when using GNU "make" to build  :oops:
Either wait for next release (any day now), or use compiler in direct-mode...

Yiannis.

Navigation

[0] Message Index

[#] Next page

Go to full version