function Promise.prototype.awaitStatus(M)M._unhandledRejection=false if M._status==Promise.Status.Started then local D=coroutine.running();(M:finally(function()task.spawn(D)end)):catch(function() end)coroutine.yield()end if M._status==Promise.Status.Resolved then return M._status,unpack(M._values,1,M._valuesLength)elseif M._status==Promise.Status.Rejected then return M._status,unpack(M._values,1,M._valuesLength)end return M._status end local function M(M,...)return M==Promise.Status.Resolved,...end

function Promise.prototype:awaitStatus()
	self._unhandledRejection = false

	if self._status == Promise.Status.Started then
		local thread = coroutine.running()

		self
			:finally(function()
				task.spawn(thread)
			end)
			-- The finally promise can propagate rejections, so we attach a catch handler to prevent the unhandled
			-- rejection warning from appearing
			:catch(
				function() end
			)

		coroutine.yield()
	end

	if self._status == Promise.Status.Resolved then
		return self._status, unpack(self._values, 1, self._valuesLength)
	elseif self._status == Promise.Status.Rejected then
		return self._status, unpack(self._values, 1, self._valuesLength)
	end

	return self._status
end

local function awaitHelper(status, ...)
	return status == Promise.Status.Resolved, ...
end
