POSIX の定義では『テキストファイル』はファイル末尾に改行が必要
3.392 Text File
A file that contains characters organized into one or more lines. https://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_392
3.205 Line
A sequence of zero or more non-
sbt起動時に Failed to construct terminal エラーが出る
$ sbt [ERROR] Failed to construct terminal; falling back to unsupported java.lang.NumberFormatException: For input string: "0x100" ...
どうも screen-256color
などがダメなようなので
下記のようなファイルをPATHの優先順位が高いところに作成して対処した
#!/bin/bash export TERM="${TERM/256color/color}" exec /usr/bin/sbt "$@"
boolから整数型に変換する時、falseは0に、trueは1になる
N1905
[conv.integral]
If the destination type is bool, see 4.12. If the source type is bool, the value false is converted to zero and the value true is converted to one.
[conv.bool]
An rvalue of arithmetic, enumeration, pointer, or pointer to member type can be converted to an rvalue of type bool. A zero value, null pointer value, or null member pointer value is converted to false any other value is converted to true.
整数型からboolに変換する時は、0
ならfalse
に、それ以外ならtrue
になる。
今素直にvue-loaderをnpm installすると面倒くさい
2018-04-25に vue-loader15がリリースされたのだけど、色々変更が多く互換性が無くて設定が面倒だったので、vue-loader 14 を入れることにした。
npm install -D vue-loader@14
pipe + fork + exec 書いてみた
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> void strwrite( int const fd, char const* const str) { if(write(fd, str, strlen(str)) < 0) { perror("write"); exit(1); } } pid_t process_open( char const* const path, int const stdin_fd, int const stdout_fd, int const* close_on_child_fds, size_t const close_on_child_fds_length, int const* close_on_parent_fds, size_t const close_on_parent_fds_length) { pid_t const child_pid = fork(); switch(child_pid) { case -1: // error perror("fork"); exit(1); case 0: // child for(size_t i = 0; i < close_on_child_fds_length; ++i) { close(close_on_child_fds[i]); } dup2(stdin_fd, STDIN_FILENO ); close(stdin_fd); dup2(stdout_fd, STDOUT_FILENO); close(stdout_fd); execl(path, path, NULL); perror(path); exit(1); default: // parent for(size_t i = 0; i < close_on_parent_fds_length; ++i) { close(close_on_parent_fds[i]); } } return child_pid; } int main() { int write_pipefd[2]; int read_pipefd[2]; if (pipe(write_pipefd) < 0 || pipe(read_pipefd)) { perror("pipe"); exit(1); } process_open("/usr/local/bin/lua", write_pipefd[0], read_pipefd[1], (const int[]){write_pipefd[1], read_pipefd[0]}, 2, (const int[]){write_pipefd[0], read_pipefd[1]}, 2); strwrite(write_pipefd[1], "print(_VERSION)"); close(write_pipefd[1]); char buf[256] = {0}; if (read(read_pipefd[0], buf, sizeof(buf)) < 0) { perror("read"); exit(1); } printf("got [%s]\n", buf); }