<p>I took me some, but I think I have an answer. I went trough the source code and found the <code>runCommand()</code> function that actually starts the command provided by notify options (it is called mostly from <code>main.cpp</code> and the code runs in a separate thread).</p>

<p>From <code>util.cpp</code></p>

<pre><code>void runCommand(std::string strCommand)
{
    int nErr = ::system(strCommand.c_str());
    if (nErr)
        LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr);
}
</code></pre>

<p>It uses the standard C library method <code>system()</code>, which is probably giving you the flashing window. Normally one would use <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx" rel="nofollow"><code>CreateProcess()</code></a> (or similar) to prevent the flash effect and have much more control over the spawned process (I don't know why the developers chose <code>system()</code> here, but I guess it was just easier). I believe the behavior of the <code>system()</code> call is system dependent.</p>

<p>Also, when you say <code>bitcoind</code>, you mean the CLI interface of bitcoin, right? Is there a <code>bitcoind</code> console window running? As for a solution, you could edit the source code to use <code>CreateProcess()</code> with the <code>DETACHED_PROCESS</code> flag, that would do the trick.</p>

CC BY-SA 3.0
2014-03-26T14:32:57.703Z
I've not yet moved to using 0.9's new bitcoin-cli executable, so I just run bitcoind and talk to it over RPC. So yes, there is a bitcoind console window running. I don't really want to patch the code, so I guess I will just have to live with it. If it annoys me enough I will stick it in a VM :) Thanks for your reply.
Avram
CC BY-SA 3.0
2014-03-26T15:46:56.063Z
I'm not quite sure what the conditions are for spawning a new shell, but I have seen this being different before on different machines. I for example don't get these flashes, no idea why. I could patch the code for you, but you'd have to recompile yourself (then we know for sure haha). You are welcome.
Jori
CC BY-SA 3.0
2014-03-26T13:47:26.870Z
2014-03-26T13:53:03.253Z
2014-03-26T13:53:03.253Z
Jori
<p>I use the <em>walletnotify</em> and <em>blocknotify</em> config options on bitcoind to have the server call two executables on new transactions/blocks. This all works fine. The two executables (Windows executables) are both designed to run without a console window, and they do.</p>

<p>That is, they do when I run them. When bitcoind runs them, I get a brief flash of a console window. As I run these on my development machine while developing, it's driving me to distraction. Does anyone have any idea to prevent this happening?</p>

<bitcoind><server>
BlockNotify/WalletNotify - but without the console window
Avram
# BlockNotify/WalletNotify - but without the console window

(Asked by: username_0 on 2014-03-26)

I use the *walletnotify* and *blocknotify* config options on bitcoind to have the server call two executables on new transactions/blocks. This all works fine. The two executables (Windows executables) are both designed to run without a console window, and they do.

That is, they do when I run them. When bitcoind runs them, I get a brief flash of a console window. As I run these on my development machine while developing, it's driving me to distraction. Does anyone have any idea to prevent this happening?

**Tags:** bitcoind, server


---

## 1 answers

### Answer by username_1 on 2014-03-26. Score: 2 | Accepted answer

I took me some, but I think I have an answer. I went trough the source code and found the runCommand() function that actually starts the command provided by notify options (it is called mostly from main.cpp and the code runs in a separate thread).
From util.cpp
void runCommand(std::string strCommand)
{
    int nErr = ::system(strCommand.c_str());
    if (nErr)
        LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr);
}

It uses the standard C library method system(), which is probably giving you the flashing window. Normally one would use CreateProcess() (or similar) to prevent the flash effect and have much more control over the spawned process (I don't know why the developers chose system() here, but I guess it was just easier). I believe the behavior of the system() call is system dependent.
Also, when you say bitcoind, you mean the CLI interface of bitcoin, right? Is there a bitcoind console window running? As for a solution, you could edit the source code to use CreateProcess() with the DETACHED_PROCESS flag, that would do the trick.

> **Comments:**
> **username_0**: I've not yet moved to using 0.9's new bitcoin-cli executable, so I just run bitcoind and talk to it over RPC. So yes, there is a bitcoind console window running. I don't really want to patch the code, so I guess I will just have to live with it. If it annoys me enough I will stick it in a VM :) Thanks for your reply.  
> **username_1**: I'm not quite sure what the conditions are for spawning a new shell, but I have seen this being different before on different machines. I for example don't get these flashes, no idea why. I could patch the code for you, but you'd have to recompile yourself (then we know for sure haha). You are welcome.  

---

