While looking for hooks history in Fossil (as Ron Wilson said I wasn't the
first) I came into this:
http://lists.fossil-scm.org:8080/pipermail/fossil-users/2011-January/003921.html
Where D. Richard Hipp said that:
...But in order to implement this different mechanism, I need example
C code for launching a background process in windows that is not
associated with an console. Doing that is easy in Unix,but I'm not
sure how to do it in windows. ..."
I used to work with Windows, so I wrote a tiny demo that I hope suits what
Richard needed. It's attached into this email. I rather go directly into a
shell that having to set up a server. Ran it with mingw, and I'm pretty
sure will run with any Microsoft compiler.
This one will print "it was a great day" whenever executed from the command
line, with one or more parameters. If I run it as a spawned process, it
won't print anything at all into the console. I want to check if this is
the needed behaviour. Please Richard, can you confirm it, or tell me
exactly what you need. I can write the Windows counterpart of the Unix
code, and even test it (have one MS box at home).
PS: thanks for the security measure, I will test it ASAP
2014-06-12 7:06 GMT-04:30 Jan Nijtmans <[email protected]>:
> 2014-06-12 13:32 GMT+02:00 Abilio Marques <[email protected]>:
> > trying to run this from command line:
> >
> > fossil test-th-eval 'http "http://localhost:8085/test?a=1"
> > fossil test-th-eval 'http "http://localhost:8085/test"
> > fossil test-th-eval 'http "http://localhost:8085/"
> > fossil test-th-eval 'http "http://www.google.com"
> >
> > While on the other side I keep a nc -klv 8085 running. I only get this
> > whenever I execute the command: "TH_ERROR: url not allowed"
> > Tried using -asynchronous, but same results. What am I doing wrong
>
>
> You should set the "th1-uri-regexp" setting to ".*" or
> "http://localhost:8085/.*" (in your case).
> This is a security measure.
>
> Regards,
> Jan Nijtmans
> _______________________________________________
> fossil-users mailing list
> [email protected]
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
int main(int argc, char *argv[])
{
unsigned int res;
char cmdName[] = "test.exe";
if (argc == 1) {
printf("spawning a process...\n");
// several functions in the _spawn family, for reference check: http://msdn.microsoft.com/en-us/library/20y988d2.aspx
res = _spawnl(_P_DETACH, cmdName, cmdName, "1", NULL); // _P_DETACH, wont do anything with the console, as D. Richard Hipp wanted
printf("%u\n", res);
system("PAUSE");
} else {
// yeah, like this is a test, it spawned itself, but writes into a file whenever is run with parameters
FILE *f = fopen("C:\\washere","a");
fprintf(f, "I was here");
fclose(f);
printf("it was a great day\n");
}
return 0;
}
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users