<commit_before>-- Additions to the posix module (of luaposix).
module ("posix", package.seeall)

require "posix_c"

--- Create a file.
-- @param file name of file to create
-- @param mode permissions with which to create file
-- @return file descriptor, or -1 on error
function creat (file, mode)
  return open (file, {"creat", "wronly", "trunc"}, mode)
end

--- Run a program like <code>os.system</code>, but without a shell.
-- @param file filename of program to run
-- @param ... arguments to the program
-- @return status exit code, or nil if fork or wait fails
-- @return error message, or exit type if wait succeeds
function system (file, ...)
  local pid = fork ()
  if pid == 0 then
    return execp (file, ...)
  else
    local pid, reason, status = wait (pid)
    return status, reason -- If wait failed, status is nil & reason is error
  end
end

--- Check permissions like <code>access</code>, but for euid.
-- Based on the glibc function of the same name. Does not always check
-- for read-only file system, text busy, etc., and does not work with
-- ACLs &c.
-- @param file file to check
-- @param mode checks to perform (as for access)
-- @return 0 if access allowed; <code>nil</code> otherwise (and errno is set)
function euidaccess (file, mode)
  local pid = getpid ()
<commit_msg>Fix a docstring mistake: refer to os.execute, not os.system.<commit_after>-- Additions to the posix module (of luaposix).
module ("posix", package.seeall)

require "posix_c"

--- Create a file.
-- @param file name of file to create
-- @param mode permissions with which to create file
-- @return file descriptor, or -1 on error
function creat (file, mode)
  return open (file, {"creat", "wronly", "trunc"}, mode)
end

--- Run a program like <code>os.execute</code>, but without a shell.
-- @param file filename of program to run
-- @param ... arguments to the program
-- @return status exit code, or nil if fork or wait fails
-- @return error message, or exit type if wait succeeds
function system (file, ...)
  local pid = fork ()
  if pid == 0 then
    return execp (file, ...)
  else
    local pid, reason, status = wait (pid)
    return status, reason -- If wait failed, status is nil & reason is error
  end
end

--- Check permissions like <code>access</code>, but for euid.
-- Based on the glibc function of the same name. Does not always check
-- for read-only file system, text busy, etc., and does not work with
-- ACLs &c.
-- @param file file to check
-- @param mode checks to perform (as for access)
-- @return 0 if access allowed; <code>nil</code> otherwise (and errno is set)
function euidaccess (file, mode)
  local pid = getpid ()

{'fraction_non_alphanumeric': 0.11686838124054463, 'fraction_numerical': 0.0022692889561270802, 'mean_word_length': 3.2252396166134187, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3970473', 'n_tokens_mistral': 780, 'n_tokens_neox': 765, 'n_words': 388}