Commit Graph

29 Commits

Author SHA1 Message Date
Takase e667b16099 Process API improvements (again) (#1370)
* feat(process): add push_error
* refactor(process): use push_error for better errors
* style(process): consistent error messages
* refactor(process): reimplement process.strerror() with push_error
* refactor(process): implement close_fd only once
* refactor(process): rename process_handle to process_handle_t
* fix(process): prevent errors from a NULL error message
* refactor(process): refactor push_error into 2 functions
* fix(process): fix wrong error message
* fix(process): check if push_error_string actually pushed something
* refactor(process): make error messages descriptive
* fix(process): check for empty table instead of aborting
* refactor(process): make error messages descriptive on Windows
* refactor(process): rename process_stream_handle to process_stream_t
* refactor(process): fix wrong usage of process_handle_t
* fix(process): fix wrong type name
* refactor(process): incoporate kill_list_thread into process_kill_list_t
* refactor(process): make kill_list per-state data
2023-08-07 15:26:38 +01:00
Takase ef70faa2fd Asynchronous process reaping (#1412)
* refactor(process): introduce process_stream_handle separate from process_handle

* feat(process): introduce process_handle helper functions

* feat(process): add asynchronous process reaping

* feat(process): wait for shorter period if possible

* style(process): remove unecessary brackets

* style(process): fix parentheses

* refactor(process): remove useless setvbuf call

* style(process): remove unecessary value

* refactor(process): add size field into kill_list

* refactor(process): use SDL_Delay for sleeping

* style(process): remove trailing whitespace

* fix(main): destroy window before closing lua

* fix(process): check for timeout correctly

* refactor(process): remove unecessary if check

* refactor(process): remove size from the list

* fix(process): fix invalid delay calculation

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>

---------

Co-authored-by: Guldoman <giulio.lettieri@gmail.com>
2023-08-07 15:26:37 +01:00
Takase 0423611a99 fix: exec() error not returned to parent (#1363)
* fix: exec() error not returned to parent

* chore: remove accidental lua.h inclusion
2023-08-07 15:02:06 +01:00
George Sokianos e4f3f1b744 Prepare 2.1.1r1 release 2023-01-29 12:58:56 +00:00
Jan aa503665e0
defer lua error until after cleanup (#1310) 2023-01-06 14:31:44 -04:00
Adam 9951e785b6
Getting ready for 2.1. (#1181)
* Getting ready for 2.1.

* Fixed version.

* Year.

* Manually added line as takase said to.

* Fixed minor issue at takase's behest.

* Dunno where that went.

* Updated to use a function pointer.

* OK, as discussed, adding this manually for now.

* Updated SDL.
2022-11-02 03:38:58 +01:00
Adam dad0f79708
Fixed process layer argument quoting; allows for strings with spaces. And added ability to specify a literal, in the style of python. (#1132) 2022-10-09 19:53:48 -07:00
Adam 293110feaa
Fix process api detach bug (#1137)
* Added in conditional, as detaching will fail with "Operation not permitted" on linux; setsid sets a new process group anyway.

* Added in variable to check detached state on cleanup, so we don't send TERM.
2022-10-04 20:02:22 -04:00
Adam 4f17667d42 Changed setpgrp to a more portable form. 2022-09-02 20:26:13 -04:00
Jan fff10a2612
Cleanup (#826)
* Update meson.build
- add logic to loop over more lua names (in the future more names might be discovered)
- disable warnings and errors on dependencies

* adding missing includes and checks, correct data types, pointer mess […]
- various functions from string.h were used but never defined
- logic was done across multiple different data types with different signedness, got all of them up to snuff
- give 0 sized array size of 1 (array of size 0 is illegal, but rewriting the code is out of the scope of this commit)
- add preprocessor that marks possibly unused argument as such (does not mean they will get optimized out or anything)
- correctly initialize structs with all data needed

All these were found by generating the project using `meson -Dwarning_level=3 -Dwerror=true`

* remove undefined behavior, correct data types

* Comment manual bit manipulation to be investigated

* check for more edge cases, replace multiple cleanups with goto

* remove system specific includes
2022-04-15 11:34:46 -04:00
Adam 3a0af6ee04
Merge pull request #828 from adamharrison/signal-processes
Changed signalling so it'll target the whole process group.
2022-02-11 12:01:53 -05:00
Guldoman d4b8155cbc
Update process status when calling `process:running` 2022-02-08 18:10:54 +01:00
Adam Harrison d2d5617774 Changed signalling so it'll target the whole process group. 2022-01-30 20:51:30 -05:00
Adam Harrison 941523868e Merge branch 'fix-process-api' of github.com:adamharrison/lite-xl into fix-process-api 2022-01-28 15:44:16 -05:00
Adam Harrison 3773a812bd Incorporate realtakase's suggestions. 2022-01-28 15:39:57 -05:00
Adam Harrison f9ad83e53e Fixed windows not converting utf8 environment block to utf16. 2022-01-22 13:34:47 -05:00
Adam Harrison ed4128bc65 Added in support for env on linux. 2022-01-22 12:36:30 -05:00
Adam Harrison 428c757a13 Implemented @guldoman's suggestion for how to close file handles. 2022-01-22 12:02:59 -05:00
takase1121 f24ebf853d
fix invalid memory access 2022-01-22 23:30:48 +08:00
Jan200101 99ddf1fb92
Migrate to Lua 5.4 2021-12-31 13:53:01 +01:00
Adam f1054b8280
Replace Reproc (#535)
Replace reproc with simpler non-dependency-based process API.
2021-12-11 15:25:35 -05:00
Adam Harrison 0777a6f0b8 Merged dev to master. 2021-07-20 14:39:50 -04:00
takase1121 c7bbf221ee remove duplicated constants 2021-07-15 18:01:24 -04:00
takase1121 818e21610c do not terminate process when read fails 2021-07-15 18:01:24 -04:00
takase1121 de3013ce88 fix wrongly spaced variable name 2021-07-15 18:01:24 -04:00
takase1121 e7b025203b add generic read function
process_read and process_read_errors no longer contain redundant code
2021-07-15 18:01:24 -04:00
takase1121 8bbb26a469 refactor process.c
- include api.h instead of individual #includes
- moved metatable name to API_TYPE_PROCESS
- moved read buffer size to READ_BUF_SIZE
2021-07-15 18:01:24 -04:00
jgmdev 88704c6ecb [api/process] added missing fields and minor fix to pid() 2021-06-22 15:01:30 -04:00
jgmdev 5d2734de81 Merge reproc changes from dev. 2021-06-18 14:19:09 -04:00