mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-09 17:41:36 +00:00
Cleanup test_compile a bit
This commit is contained in:
parent
a038477ce0
commit
15cdeef552
1 changed files with 6 additions and 9 deletions
15
setup.py
15
setup.py
|
|
@ -240,18 +240,15 @@ def test_compile(
|
|||
) -> bool:
|
||||
src = src or 'int main(void) { return 0; }'
|
||||
with tempfile.TemporaryDirectory(prefix='kitty-test-compile-') as tdir:
|
||||
with open(os.path.join(tdir, f'source.{lang}'), 'w', encoding='utf-8') as srcf:
|
||||
print(src, file=srcf)
|
||||
p = subprocess.Popen(
|
||||
[cc] + list(cflags) + ([] if link_also else ['-c']) + ['-x', lang, '-o', os.path.join(tdir, 'dummy'), '-'] +
|
||||
[cc] + list(cflags) + ([] if link_also else ['-c']) +
|
||||
['-o', os.path.join(tdir, 'source.output'), srcf.name] +
|
||||
[f'-l{x}' for x in libraries] + list(ldflags),
|
||||
stdout=subprocess.DEVNULL, stdin=subprocess.PIPE, stderr=None if show_stderr else subprocess.DEVNULL
|
||||
stdout=subprocess.DEVNULL, stdin=subprocess.DEVNULL,
|
||||
stderr=None if show_stderr else subprocess.DEVNULL
|
||||
)
|
||||
stdin = p.stdin
|
||||
assert stdin is not None
|
||||
try:
|
||||
stdin.write((src + '\n').encode('utf-8'))
|
||||
stdin.close()
|
||||
except BrokenPipeError:
|
||||
return False
|
||||
return p.wait() == 0
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue