Skip to content

Commit ad9f07c

Browse files
authored
Merge pull request #26 from snmsts/windows-without-dll
Port dll function via lisp with CFFI on windows.Clean up windows rela…
2 parents 3b16b91 + 8a9bb11 commit ad9f07c

8 files changed

Lines changed: 295 additions & 203 deletions

File tree

.github/workflows/build.yml

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -133,63 +133,3 @@ jobs:
133133
with:
134134
name: ${{ env.RESULT_NAME }}
135135
path: ${{ env.RESULT_PATH }}
136-
137-
build-windows:
138-
runs-on: windows-latest
139-
timeout-minutes: 90
140-
strategy:
141-
fail-fast: false
142-
matrix:
143-
arch: [x86_64, i686]
144-
include:
145-
- arch: x86_64
146-
arch2: x86_64
147-
bit: 64
148-
- arch: i686
149-
arch2: x86
150-
bit: 32
151-
env:
152-
OS_NAME: windows
153-
ARCH_NAME: ${{ matrix.arch2 }}
154-
DLL_NAME: libasyncprocess.dll
155-
RESULT_NAME: result-windows-${{ matrix.arch }}
156-
RESULT_PATH: result-windows-${{ matrix.arch }}
157-
RESULT_PATH_SUB: result-async/static
158-
steps:
159-
- run: git config --global core.autocrlf false
160-
- uses: actions/checkout@v2
161-
- uses: msys2/setup-msys2@v2
162-
with:
163-
msystem: MINGW${{ matrix.bit }}
164-
path-type: inherit
165-
release: true
166-
update: true
167-
install: 'base-devel mingw-w64-${{ matrix.arch }}-toolchain'
168-
- name: Run MSYS2 once
169-
shell: msys2 {0}
170-
run: |
171-
pwd
172-
echo $MSYSTEM
173-
echo $MSYS2_PATH_TYPE
174-
echo $PATH
175-
uname
176-
uname -m
177-
- name: Build
178-
shell: msys2 {0}
179-
run: |
180-
gcc -v
181-
rm static/$ARCH_NAME/$OS_NAME/$DLL_NAME
182-
./bootstrap
183-
- name: Copy Result
184-
if: always()
185-
shell: msys2 {0}
186-
run: |
187-
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
188-
cp static/$ARCH_NAME/$OS_NAME/$DLL_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
189-
- name: Upload Result
190-
if: always()
191-
uses: actions/upload-artifact@v1
192-
with:
193-
name: ${{ env.RESULT_NAME }}
194-
path: ${{ env.RESULT_PATH }}
195-

src/async-process.asd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
:license "MIT"
66
:depends-on ("cffi")
77
:serial t
8-
:components ((:file "async-process")))
8+
:components ((:file "async-process_windows"
9+
:if-feature (:or :win32 :windows))
10+
(:file "async-process"
11+
:if-feature (:not (:or :win32 :windows)))))

src/async-process.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "async-process.h"
22

3-
#ifndef HAVE_WINDOWS_H
4-
53
static const char* open_pty(int *out_fd)
64
{
75
int fd = posix_openpt(O_RDWR | O_CLOEXEC | O_NOCTTY);
@@ -133,4 +131,3 @@ int process_alive_p(struct process *process)
133131
{
134132
return kill(process->pid, 0) == 0;
135133
}
136-
#endif

src/async-process.h

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,12 @@
55
# include "config.h"
66
#endif
77

8-
9-
#ifdef HAVE_WINDOWS_H
10-
# include <windows.h>
11-
#else
12-
# define _GNU_SOURCE
13-
# include <signal.h>
14-
# include <errno.h>
15-
# include <fcntl.h>
16-
# include <sys/wait.h>
17-
# include <termios.h>
18-
#endif
8+
#define _GNU_SOURCE
9+
#include <signal.h>
10+
#include <errno.h>
11+
#include <fcntl.h>
12+
#include <sys/wait.h>
13+
#include <termios.h>
1914

2015
#include <stdio.h>
2116
#include <unistd.h>
@@ -25,16 +20,9 @@
2520

2621
struct process {
2722
char buffer[1024*4];
28-
#ifdef HAVE_WINDOWS_H
29-
PROCESS_INFORMATION pi;
30-
HANDLE hInputWrite;
31-
HANDLE hOutputRead;
32-
bool nonblock;
33-
#else
3423
int fd;
3524
char *pty_name;
3625
pid_t pid;
37-
#endif
3826
};
3927

4028
struct process* create_process(char *const command[], bool nonblock, const char *path);

src/async-process_windows.c

Lines changed: 0 additions & 121 deletions
This file was deleted.

0 commit comments

Comments
 (0)