From a81fecb56465a859c711a769f9c41d1885038d13 Mon Sep 17 00:00:00 2001 From: Pelanyo Kamara Date: Tue, 9 Nov 2021 15:28:18 +0000 Subject: [PATCH] fix dangling ptr issue --- .github/workflows/build.yml | 26 +------------------------- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ CLI/Repl.cpp | 3 ++- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 78a66a7d..34ee71cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,28 +82,4 @@ jobs: - uses: actions/upload-artifact@v2 with: name: coverage - path: coverage - - web: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - name: setup emsdk - uses: mymindstorm/setup-emsdk@v9 - with: - version: 1.38.40 - actions-cache-folder: 'emsdk-cache' - - name: verify emsdk - run: | - emcc -v # verify emscripten installed successfully - - name: cmake configure - run: | - emcmake cmake . - - name: build - run: | - cmake --build . --target Luau.Repl.CLI --config Debug # as seen above but only Repl.CLI. - - uses: actions/upload-artifact@v2 - with: - name: luau-web-artifacts - path: docs/assets/luau/ - if-no-files-found: error \ No newline at end of file + path: coverage \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2fd8d3d5..ae0aaa69 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,3 +33,31 @@ jobs: with: name: luau-${{matrix.os}} path: Release\luau*.exe + web: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: setup emsdk + uses: mymindstorm/setup-emsdk@v9 + with: + version: 1.38.40 + actions-cache-folder: 'emsdk-cache' + - name: verify emsdk + run: | + emcc -v # verify emscripten installed successfully + - name: cmake configure + run: | + emcmake cmake . + - name: build + run: | + cmake --build . --target Luau.Repl.CLI --config Debug # as seen above but only Repl.CLI. + - uses: actions/upload-artifact@v2 + with: + name: luau.wasm + path: docs/assets/luau/luau.wasm + if-no-files-found: error + - uses: actions/upload-artifact@v2 + with: + name: luau.js + path: docs/assets/luau/luau.js + if-no-files-found: error \ No newline at end of file diff --git a/CLI/Repl.cpp b/CLI/Repl.cpp index 36159841..a3880b5f 100644 --- a/CLI/Repl.cpp +++ b/CLI/Repl.cpp @@ -223,9 +223,10 @@ extern "C" std::string error = runCode(L, source); // output error(s) + static std::string result = error; if (error.length()) { - return std::move(error.c_str()); + return result.c_str(); } return NULL; }