Skip to content

Commit 1dd89ea

Browse files
committed
Merge branch 'master' into win32
2 parents a112b1b + 34c24fb commit 1dd89ea

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

platform/win32.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ sl_environ(sl_vm_t* vm)
118118
size_t i = 0;
119119
for(char* eptr = envzz; *eptr; eptr += strlen(eptr) + 1) {
120120
enva[i] = sl_alloc_buffer(vm->arena, strlen(eptr) + 1);
121-
strcpy(enva[i], eptr);
122-
i++;
121+
strcpy(enva[i], eptr);
122+
i++;
123123
}
124124
enva[i] = NULL;
125125
FreeEnvironmentStrings(envzz);

sapi/cli/cli.c

+24
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
#include <stdio.h>
55
#include "readline.h"
66

7+
#ifdef SL_HAS_UNISTD
8+
#include <unistd.h>
9+
#endif
10+
11+
#ifdef __WIN32
12+
#include <io.h>
13+
#endif
14+
715
static bool
816
opt_interactive;
917

@@ -213,6 +221,22 @@ main(int argc, char** argv)
213221
{
214222
sl_vm_t* vm = setup_vm(&argc);
215223

224+
if(argc == 1) {
225+
// if we have no command line args and we're running in a TTY,
226+
// enable interactive mode by default
227+
#ifdef SL_HAS_UNISTD
228+
if(isatty(0)) {
229+
opt_interactive = true;
230+
}
231+
#else
232+
#ifdef __WIN32
233+
if(_isatty(_fileno(stdin))) {
234+
opt_interactive = true;
235+
}
236+
#endif
237+
#endif
238+
}
239+
216240
process_arguments(vm, argc, argv);
217241

218242
sl_vm_frame_t frame;

0 commit comments

Comments
 (0)