How can I run hg commands in the background (without showing the command prompt window)? - mercurial

I am using firefox extension to run hg commands on my repository. But when ever I execute any hg commands it shows command prompt window for a split second and closes it.
Eg:-
process.run("push");
process.run("update");
Is there any way to not show that window at all ?

Back in the day I used to have a tool that was hidewin.exe that would all you to start any bat file or exe file and have it run invisibly. I tried a google search for it but didn't find it easily but maybe you could have better luck at finding it.

Related

Restart Sikuli script after error - calling from command line

If I run a script manually from the IDE and it errors out somewhere, I am able to just hit Run again and it continues from where it left off. If I call a script from command line, is there any way to do this?
Running it from command line does not open the IDE, it just starts running the script and if it fails, I am not notified in any way, nor do I see a way to restart the process. I am using command line because it is an automated task that runs on its own.
Decided to go another route as I found out this is not possible.

InstallShield 2014, Custom Actions and executing sql files into MySQL

I am building an installer for our product which works well. I've managed to build custom actions to install our services including a MySQL server.
The problem I have is executing a sql file to build the schema structures.
I have a custom action which uses mysql.exe and the command line arguments:
--port=### --user=### --password=### < "[INSTALLDIR]db\EmptyStruct.sql"
It tries to execute this ok but the cmd window which pops up, during the install, just runs through the mysql.exe command line options, which says to me that the command line it gets passed is not correct. However if I run the command manually after the install, it works perfectly.
Does anyone has any ideas please.
I'm making a few assumptions here:
You have a Windows Installer exe custom action that specifies mysql.exe and a command line as you showed
You are expecting the contents of [INSTALLDIR]db\EmptyStruct.sql to be redirected to mysql.exe's standard input
This will not happen. Behind the scenes, Windows Installer's exe custom action support uses the CreateProcess API and this API will interpret command lines literally. However the redirect < needs special handling to actually perform redirection.
To get that behavior, you must use a layer of indirection. For example, you could run cmd.exe as the exe, and give it a command line that will make it interpret and run the command line mysql.exe --port= ... < "[INSTALLDIR]...". However, if you didn't already have a command prompt showing, this would cause one to show up. If you want to avoid that, you could write a custom wrapper that performs the redirection for you, either as a C++ DLL or, say, InstallScript action.
Alternately, if there is a parameter that tells mysql.exe to run a script from a file, you could pass that instead of using redirection. I wasn't able to find evidence of such a parameter in a quick web search.
Thanks for your comments Michael and I used cmd.exe /k AddStruct.bat to accomplish the task!

How do I run a TCL script on files from my file manager?

I'm working on a simple TCL script that makes a few Tk dialogs appear and then compresses a file given by argv. It works just fine from the terminal by running "./script file", but since it's a graphical wrapper for a command-line utility, I want it to run from the right-click menu in a file manager.
I copied it to /usr/bin and used Caja's "Open With Other Application..." option on a random file (no spaces in the path), and entered the name of my script as the application to use. When I tried to open the file this way, there were no dialogs and no archive.
However when I tried to run the script from the terminal again, without the "./", it still worked.
What needs to be done to run a TCL script on a file from the right-click menu and still be platform independant?
Maybe you could start with determining wether Tcl or the file manager is the problem. Write a shell script...
#!/bin/sh
exec rm -- "$#"
...make it executable with chmod +x and try to use it as an "other application" on a file you don't care about. If the file isn't erased, Tcl isn't to blaim.
I have fixed the script in question. I don't know why the dialogs broke or why they are working now, but the archive was apparently failing to appear because the script's working directory was automatically set to my home folder by the file manager.
The code below is what I used to direct my script to the right folder. It changes the working directory to the one containing the file that the script is being run on.
cd [file dirname $argv]
Once I set that, most of my issues seemed to be resolved, and I can now continue dveloping my script.

How to call hg commands through firefox extension?

I am trying to automate hg commit and hg push commands , for that I need to call those commands from firefox extension (which I am working on). Is there a way to do it without using batch files ?
Yes, you can just call hg directly like any other process.
See here how to make a command line call from within a firefox extension.
Of course for the call "initWithPath" you must specify the hg command line binary, that is also executed when you type "hg" in a Terminal window. And this command line utility will have different locations on different platforms. So if you expect the extension to work crossplatform, you should offer a preferences panel, where the users can enter the path to their local hg binary and by default you could also put there the standard path where most users on that platform would have installed hg to.

Has anyone used "hstart.exe"?

What I trying to do is to run hg commands using firefox extension without showing command prompt window all the time.
I initiate process with hg.exe file and then execute hg commands by passing arguments in to it.
process.init("hg.exe");
args["update"];
process.run(true,args,args.lenght);
But I am confused how I am going to use hstart.exe on top of it
Any suggestions ?
Just pass hg commands as arguments in hstart.exe...that will do the trick !!!