Skip to content

Commit

Permalink
Fix writing to the pipe on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rollerozxa committed Jun 24, 2024
1 parent 72ac82e commit d8be41f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/tms/backend/pipe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,15 @@ void setup_pipe(int argc, char **argv)
&dwMode,
0,0);

int len = strlen(argv[1]);
DWORD written;
if (!(WriteFile(pipe_h, argv[1], len, &written, 0))) {
tms_errorf("error writing to pipe");
if (argc > 1) {
DWORD written;
if (!(WriteFile(pipe_h, argv[1], strlen(argv[1]), &written, 0))) {
tms_errorf("error writing to pipe");
}

tms_infof("done");
}

tms_infof("done");
CloseHandle(pipe_h);

/* bring the window to the front */
Expand Down

0 comments on commit d8be41f

Please sign in to comment.