kevinlawler / kona

Open-source implementation of the K programming language
ISC License
1.36k stars 138 forks source link

`3: doesn't pass arguments correctly on Windows (this one is a bug, I swear!!) #464

Closed refi64 closed 4 years ago

refi64 commented 7 years ago

Create a file named x.bat containing:

@echo First arg: %1

This should print the first argument, e.g. x.bat 123 should print First arg: 123. This works perfectly from the command prompt or PowerShell. From K, however:

K Console - Enter \ for help

  `3:"x.bat 123"
  First arg:

Nothing!

refi64 commented 7 years ago

This might be because Kona calls CreateProcess with a S* (or char**):

if( !CreateProcess(NULL,argv /* <-- HERE */,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi) ) {

but it expects a normal string.

tavmem commented 4 years ago

Looks like kona behaves exactly like k3.2 in this case:

$ cd k3.2
$ ls
doc  k.exe  k20.dll  kdoc.zip  ksetup.exe  kwin.zip  x.bat
$ cat x.bat
@echo First arg: %1
$ ./k
K 3.2 2005-06-25 Copyright (C) 1993-2004 Kx Systems

`3:"x.bat 123"

Also get Nothing!