Skip to content

Commit

Permalink
Remove util_spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Aug 15, 2024
1 parent 6bd3b7d commit 604c616
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 490 deletions.
14 changes: 0 additions & 14 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ if(ERT_HAVE_OPENDIR)
list(APPEND opt_srcs util/util_opendir.cpp)
endif()

if(ERT_HAVE_SPAWN)
list(APPEND opt_srcs util/util_spawn.cpp)
endif()

if(ERT_HAVE_UNISTD)
list(APPEND opt_srcs util/path_stack.cpp)
endif()
Expand Down Expand Up @@ -244,10 +240,6 @@ target_link_libraries(ert_util_copy_file resdata)
add_test(NAME ert_util_copy_file COMMAND ert_util_copy_file
$<TARGET_FILE:ert_util_copy_file>)

add_executable(ert_util_file_readable util/tests/ert_util_file_readable.cpp)
target_link_libraries(ert_util_file_readable resdata)
add_test(NAME ert_util_file_readable COMMAND ert_util_file_readable)

add_executable(ert_util_path_stack_test util/tests/ert_util_path_stack_test.cpp)
target_link_libraries(ert_util_path_stack_test resdata)
add_test(NAME ert_util_path_stack_test
Expand All @@ -263,12 +255,6 @@ add_executable(ert_util_type_vector_test
target_link_libraries(ert_util_type_vector_test resdata)
add_test(NAME ert_util_type_vector_test COMMAND ert_util_type_vector_test)

if(ERT_HAVE_SPAWN)
add_executable(ert_util_spawn util/tests/ert_util_spawn.cpp)
target_link_libraries(ert_util_spawn resdata)
add_test(NAME ert_util_spawn COMMAND ert_util_spawn)
endif()

foreach(
name
rd_fault_block_layer
Expand Down
10 changes: 0 additions & 10 deletions lib/include/ert/util/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ double util_difftime_seconds(time_t start_time, time_t end_time);
char *util_alloc_sprintf_va(const char *fmt, va_list ap);
char *util_alloc_sprintf(const char *, ...);
bool util_sscanf_isodate(const char *, time_t *);
bool util_is_executable(const char *);
bool util_entry_exists(const char *entry);
bool util_file_exists(const char *);
bool util_is_abs_path(const char *);
Expand All @@ -127,8 +126,6 @@ char *util_alloc_normal_path(const char *input_path);
char *util_alloc_realpath(const char *);
char *util_alloc_realpath__(const char *input_path);
bool util_string_has_wildcard(const char *s);
bool util_file_readable(const char *file);
bool util_entry_readable(const char *entry);
bool util_ftruncate(FILE *stream, long size);

int util_roundf(float x);
Expand Down Expand Up @@ -318,13 +315,6 @@ char *util_alloc_atlink_target(const char *path, const char *link);
#endif
#endif

#ifdef ERT_HAVE_SPAWN
pid_t util_spawn(const char *executable, int argc, const char **argv,
const char *stdout_file, const char *stderr_file);
int util_spawn_blocking(const char *executable, int argc, const char **argv,
const char *stdout_file, const char *stderr_file);
#endif

#include "util_unlink.hpp"

#ifdef __cplusplus
Expand Down
34 changes: 0 additions & 34 deletions lib/util/tests/ert_util_file_readable.cpp

This file was deleted.

174 changes: 0 additions & 174 deletions lib/util/tests/ert_util_spawn.cpp

This file was deleted.

59 changes: 0 additions & 59 deletions lib/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1449,65 +1449,6 @@ bool util_is_file(const char *path) {
}
}

/**
Will return false if the path does not exist.
*/

#ifdef ERT_HAVE_SPAWN
bool util_is_executable(const char *path) {
if (util_file_exists(path)) {
stat_type stat_buffer;
util_stat(path, &stat_buffer);
if (S_ISREG(stat_buffer.st_mode))
return (stat_buffer.st_mode & S_IXUSR);
else
return false; /* It is not a file. */
} else /* Entry does not exist - return false. */
return false;
}

/*
Will not differtiate between files and directories.
*/
bool util_entry_readable(const char *entry) {
stat_type buffer;
if (util_stat(entry, &buffer) == 0)
return buffer.st_mode & S_IRUSR;
else
return false; /* If stat failed - typically not existing entry - we return false. */
}

bool util_file_readable(const char *file) {
if (util_entry_readable(file) && util_is_file(file))
return true;
else
return false;
}

#else
// Windows: executable status based purely on extension ....

bool util_is_executable(const char *path) {
char *ext;
util_alloc_file_components(path, NULL, NULL, &ext);
if (ext != NULL)
if (strcmp(ext, "exe") == 0)
return true;

return false;
}

/* If it exists on windows it is readable ... */
bool util_entry_readable(const char *entry) {
stat_type buffer;
if (util_stat(entry, &buffer) == 0)
return true;
else
return false; /* If stat failed - typically not existing entry - we return false. */
}

#endif

static size_t util_get_path_length(const char *file) {
if (util_is_directory(file))
return strlen(file);
Expand Down
Loading

0 comments on commit 604c616

Please sign in to comment.